from recbole.quick_start import load_data_and_model
import numpy as np

from recbole.utils.case_study import full_sort_topk

config, model, dataset, train_data, valid_data, test_data = load_data_and_model(
        model_file='saved/BPR-Mar-09-2022_16-53-52.pth',
        # model_file='E:\code\Pycharm\RecBole\saved\LR-Mar-08-2022_20-18-23.pth',
    )  # Here you can replace it by your model path.

uid_series = dataset.token2id(dataset.uid_field, ['5045'])
test_data.is_sequential = True
topk_score, topk_iid_list = full_sort_topk(uid_series, model, test_data, k=10, device=config['device'])
print('topk_score:',topk_score,'topk_iid_list:', topk_iid_list[:1][0].numpy())

# topk_score, topk_iid_list = full_sort_topk(uid_series, model, test_data, k=10, device=config['device'])
# print('topk_score:',topk_score,'topk_iid_list:', topk_iid_list)
